package com.ymk.cmd;

import com.ymk.base.cmd.ACmd;
import com.ymk.base.cmd.CmdSign;
import com.ymk.bo.orders.OrdersBO;
import com.ymk.core.code.cmd.OrdersCmdCode;
import com.ymk.service.IOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

@Service
public class OrdersDelCmd extends ACmd {

    @Override
    public CmdSign executeMop(HttpServletRequest request, CmdSign sign) throws Exception {
        CmdSign respSign = new CmdSign(sign);
        OrdersBO reqData = super.getData(sign, OrdersBO.class);

        OrdersBO delOrdersBO = new OrdersBO();
        delOrdersBO.setId(reqData.getId());
        this.OrdersService.del(delOrdersBO);

        return respSign;
    }

    @Override
    public String getCmdCode() {
        return OrdersCmdCode.ORDERS_DEL;
    }

    @Autowired
    private IOrdersService OrdersService;
}